<head>

    <link href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctx}/css/index.css" rel="stylesheet">
    <link href="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.css" rel="stylesheet">
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <script src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/extensions/export/bootstrap-table-export.min.js"></script>
    <script src="${ctx}/js/extends.js"></script>
    <script src="${ctx}/layui/layui.all.js"></script>
    <script src="${ctx}/js/util.js"></script>
    <link href="${ctx}/layui/css/layui.css" rel="stylesheet">
    <style>
        .btn {
            font-size: 12px;
        }

        .line_item {
            display: inline-block;
            height: 43px;
            margin-right: 10px;
        }

        .line_lab {
            padding: 0;
            line-height: 38px;
            width: 160px;
            margin-right: 10px;
            float: left;
        }

        .line_block {
            width: 300px;
            margin-left: 0;
            float: left;
        }

        .line_block input {
            padding-right: 10px;
        }

        .data_table {
            padding: 0 25px;
        }

        .layui-form-checkbox[lay-skin=primary] i {
            top: 5px;
        }
    </style>
</head>
<body>
<br><br>

<form class="layui-form" action="" lay-filter="item" style="width: 500px;margin: 0 auto;">
    <input type="hidden" name="id" readonly value="${item.id!''}">
    <input type="hidden" name="rouseId" readonly value="${item.rouseId!''}">
    <div class="layui-form-item">
        <label class="layui-form-label line_lab">任务类型</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="sosoType" value="1" title="cpa" lay-filter="sosoType"
                   <#if item.sosoType==1>checked</#if>>
            <input type="radio" name="sosoType" value="0" title="cpsa" lay-filter="sosoType"
                   <#if item.sosoType==0>checked</#if>>
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>包名</label>
        <div class="layui-input-block line_block">
            <input type="text" name="pkgName"
                   lay-verify="required" placeholder="请输入包名"
                   autocomplete="off" class="layui-input" value="${item.pkgName!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>app名称</label>
        <div class="layui-input-block line_block">
            <input type="text" name="appName"
                   lay-verify="required" placeholder="请输入app名称"
                   autocomplete="off" class="layui-input" value="${item.appName!''}">
        </div>
    </div>

    <div class="layui-form-item line_item cpa" >
        <label class="layui-form-label line_lab"><span class="c-red">*</span>下载地址</label>
        <div class="layui-input-block line_block">
            <input type="text" name="downUrl"
                    placeholder="请输入下载地址"
                   autocomplete="off" class="layui-input" value="${item.downUrl!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>图标</label>
        <div class="layui-input-block line_block">
            <input type="text" name="icon"
                   lay-verify="required" placeholder="请输入图标"
                   autocomplete="off" class="layui-input" value="${item.icon!''}">
        </div>
    </div>





    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>排序</label>
        <div class="layui-input-block line_block">
            <input type="text" name="sort"
                   lay-verify="required" placeholder="请输入排序"
                   autocomplete="off" class="layui-input" value="${item.sort!'99'}">
        </div>
    </div>




    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>金币</label>
        <div class="layui-input-block line_block">
            <input type="text" name="rewardPoint"
                   lay-verify="required" placeholder="请输入金币"
                   autocomplete="off" class="layui-input" value="${item.rewardPoint!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>金钱(分)</label>
        <div class="layui-input-block line_block">
            <input type="text" name="rewardMoney"
                   lay-verify="required" placeholder="请输入金钱(分)"
                   autocomplete="off" class="layui-input" value="${item.rewardMoney!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>任务名称</label>
        <div class="layui-input-block line_block">
            <input type="text" name="taskName"
                   lay-verify="required" placeholder="请输入任务名称"
                   autocomplete="off" class="layui-input" value="${item.taskName!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>体验时间（秒）</label>
        <div class="layui-input-block line_block">
            <input type="number" name="rouseTime"
                   lay-verify="required" placeholder="请输入体验时间（秒）"
                   autocomplete="off" class="layui-input" value="${item.rouseTime!'180'}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>任务数量,0代表无限</label>
        <div class="layui-input-block line_block">
            <input type="number" name="recordCount"
                   lay-verify="required" placeholder="请输入任务数量,0代表无限"
                   autocomplete="off" class="layui-input" value="${item.recordCount!''}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>任务每日数量,0代表无限</label>
        <div class="layui-input-block line_block">
            <input type="number" name="dayAmount"
                   lay-verify="required" placeholder="请输入任务数量,0代表无限"
                   autocomplete="off" class="layui-input" value="${item.dayAmount!''}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>支持版本号</label>
        <div class="layui-input-block line_block">
            <input type="number" name="version"
                   lay-verify="required" placeholder="请输入支持版本号"
                   autocomplete="off" class="layui-input" value="${item.version!''}">
        </div>
    </div>



    <div class="layui-form-item line_item  ">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>指定市场渠道</label>
        <div class="layui-input-block line_block">
            <select class="form-control" id="brand" name="brand">
                <option value="all">不限设备</option>
                <#list appStoreList as list>
                    <option value="${list.code}" <#if item.brand??><#if list.code==item.brand>selected</#if></#if>>${list.name}</option>
                </#list>
            </select>
        </div>
    </div>

    <div class="layui-form-item line_item   cpsa">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>应用市场排名</label>
        <div class="layui-input-block line_block">
            <input type="text" name="appStoreSort"
                   placeholder="请输入应用市场排名"
                   autocomplete="off" class="layui-input" value="${item.appStoreSort!''}">
        </div>
    </div>

    <div class="layui-form-item line_item   cpsa">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>搜索关键字</label>
        <div class="layui-input-block line_block">
            <input type="text" name="keyWords"
                    placeholder="请输入搜索关键字"
                   autocomplete="off" class="layui-input" value="${item.keyWords!''}">
        </div>
    </div>

    <div class="layui-form-item line_item   cpsa">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>指定渠道的下载地址</label>
        <div class="layui-input-block line_block">
            <input type="text" name="appStorePkgUrl"
                    placeholder="请输入指定渠道的下载地址"
                   autocomplete="off" class="layui-input" value="${item.appStorePkgUrl!''}">
        </div>
    </div>

    <div class="layui-form-item line_item" onclick="findType()">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>签到配置策略</label>
        <div class="layui-input-block line_block">
            <input type="text" id="strategyId" name="strategyId"
                    placeholder="请输入签到配置策略id"
                   autocomplete="off" class="layui-input" readonly value="${item.strategyId!''}">
        </div>

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label line_lab">过滤截图任务</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="openFiter" value="1" title="开启" lay-filter="openFiter"
                   <#if item.openFiter==1>checked</#if>>
            <input type="radio" name="openFiter" value="0" title="关闭" lay-filter="openFiter"
                   <#if item.openFiter==0>checked</#if>>
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>过滤截图任务id</label>
        <div class="layui-input-block line_block">
            <input type="text" name="fiterKeywords"
                   lay-verify="required" placeholder="请输入过滤截图任务id"
                   autocomplete="off" class="layui-input" value="${item.fiterKeywords!''}">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label line_lab">奖励类型</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="rewardType" value="1" title="钱（分）" lay-filter="rewardType"
                   <#if item.rewardType==1>checked</#if>>
            <input type="radio" name="rewardType" value="0" title="金币" lay-filter="rewardType"
                   <#if item.rewardType==0>checked</#if>>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">是否全局优先</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="isFirst" value="1" title="开启" lay-filter="isFirst"
                   <#if item.isFirst==1>checked</#if>>
            <input type="radio" name="isFirst" value="0" title="关闭" lay-filter="isFirst"
                   <#if item.isFirst==0>checked</#if>>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label line_lab">是否开启签到</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="isClick" value="1" title="开启" lay-filter="isClick"
                   <#if item.isClick==1>checked</#if>>
            <input type="radio" name="isClick" value="0" title="关闭" lay-filter="isClick"
                   <#if item.isClick==0>checked</#if>>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label line_lab">安卓版本限制</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="ovsType" value="1" title="仅安卓10" lay-filter="isFirst1"
                   <#if item.ovsType==1>checked</#if>>
            <input type="radio" name="ovsType" value="0" title="安卓10以下" lay-filter="isFirst1"
                   <#if item.ovsType==0>checked</#if>>
            <input type="radio" name="ovsType" value="2" title="全部" lay-filter="isFirst1"
                   <#if item.ovsType==2>checked</#if>>
        </div>
    </div>
   <#-- <div class="layui-form-item">
        <label class="layui-form-label line_lab">是否自有的数据源</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="isMy" value="1" title="开启" lay-filter="isClick" <#if item.isMy==1>checked</#if>>
            <input type="radio" name="isMy" value="0" title="关闭" lay-filter="isClick" <#if item.isMy==0>checked</#if>>
        </div>
    </div>-->


    <div class="layui-form-item">
        <div class="layui-input-block" style="text-align: center;margin: 0">
            <button class="layui-btn" lay-submit lay-filter="formUpdate">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>


<script>
    function findType() {
        layer_show("选择签到策略", "/sys/clickstrategy/list", 1400, 850)
    }

    function returenId(id) {
        $("#strategyId").val(id);
    }

    $(document).ready(function () {
        let sosoType = '${item.sosoType}';
        if(sosoType=='1'){
            $(".cpa").show();
            $(".cpsa").hide();
        } else {
            $(".cpa").hide();
            $(".cpsa").show();
        }

        layui.use('form', function () {

            var form = layui.form;
            form.render();
            form.on('submit(formUpdate)', function (data) {
                $.ajax({
                    url: "/sys/taskrousedetail/edit",    //请求的url地址
                    dataType: "json",   //返回格式为json
                    async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                    data: data.field,    //参数值,键值对
                    type: "post",   //请求方式
                    beforeSend: function () {
                        //请求前的处理
                    },
                    success: function (req) {
                        //请求成功时处理
                        if (req.success) {
                            layer.msg(req.message)
                        } else {
                            layer.msg(req.message)
                        }
                    },
                    complete: function () {
                        //请求完成的处理
                    },
                    error: function () {
                        //请求出错处理
                        layer.msg("请重试！若在失败请联系管理员")
                    }
                });

                return false;
            });
            form.on("radio(sosoType)", function (data) {
                if (this.value == '1') {
                    $(".cpa").show();
                    $(".cpsa").hide();
                } else if (this.value == '0') {
                    $(".cpa").hide();
                    $(".cpsa").show();
                }
            });
        });
    });


</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>